<%= turbo_frame_tag :dialog do %>
  <%= form_for @invitation,
    url: spree.admin_invitations_path,
    data: { controller: "enable-button" } do |f| %>
    <%= dialog_header Spree.t('actions.send_invitation') %>
    <div class="dialog-body">
      <%= render 'spree/admin/shared/error_messages', target: @invitation %>
      <%= f.spree_email_field :email, required: true, data: { 'enable-button-target': 'input' }, placeholder: 'eg. steve@apple.com', autofocus: true %>
      <% if @roles.any? %>
        <%= f.spree_select :role_id, @roles.map { |role| [role.name, role.id] }, { label: Spree.t(:role_id), autocomplete: true, required: true }, { data: { 'enable-button-target': 'input' } } %>
      <% end %>
      <%= f.spree_date_field :expires_at, required: true, data: { 'enable-button-target': 'input' } %>
    </div>
    <div class="dialog-footer">
      <%= dialog_discard_button %>
      <%= turbo_save_button_tag do %>
        <%= icon 'send' %>
        <%= Spree.t('actions.send_invitation') %>
      <% end %>
    </div>
  <% end %>
<% end %>
